<template>
  <div class="world">
     <!-- 头部 -->
    <div class="header">
        <div class="logo">
            <img src="../assets/imgs/logo.jpg" alt="">
        </div>
        <div class="inp">
            <div class="fdj">
                <img src="../assets/imgs/放大镜.png" alt="">
            </div>
            <div class="wenzi">搜索你爱的</div>
        </div>
        <router-link tag="div" to="/myspace" class="booklist">
            <div class="imgs">
                <img src="../assets/imgs/书架.png" alt="">
            </div>
            <div class="wenzi">
                书架
            </div>
        </router-link>
    </div>
    <!-- 切换 -->
    <div class="tabs">
        <router-link tag="div" to="/home" class="faxian">发现</router-link>
        <router-link tag="div" to="/rec" class="tuijian">推荐</router-link>
        <div class="shijie">世界</div>
    </div>
    <!-- 瀑布流 -->
    <div class="pubu">
        <div class="item" v-for="(item,index) in world" :key="index">
            <div class="imgs">
                <img :src="item.imgs" alt="">
            </div>
            <div class="wenzi">{{item.title}}</div>
            <div class="people">
                {{item.name}}
            </div>
        </div>
        
    </div>
  </div>
</template>

<script>
import { getHomeData } from "../api/booklists"
export default {
    data(){
        return{
            world:null
        }
    },
    created(){
        getHomeData().then((data)=>{
            this.world = data.world
            console.log(this.world)
        })
    }
}
</script>

<style lang="scss">
.world .pubu{
    width: 100%;
    padding: 0 2%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    height: 1200px;
    flex-direction: row;
    .item{
        display: flex;
        flex-direction: column;
        width: 48%;
        box-sizing: border-box;
        padding: 0 2%;
        display: flex;
        .imgs{
            width: 96%;
            margin: 0 auto;
            img{
                width: 100%;
                display: block;
                height: auto;
            }
        }
    }
}
.world .header{
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
    .logo{
        width: 46px;
        height: 46px;
        margin-left: 4px;
        img{
            width: 100%;
        }
    }
    .inp{
        flex: 1;
        height: 30px;
        border-radius: 15px;
        background-color: #dfdfdf;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 10px;
        .fdj{
            width: 20px;
            height: 20px;
            img{
                width: 100%;
            }
        }
        .wenzi{
            height: 20px;
            line-height: 20px;
            font-size: 12px;
            color: #000;
        }

    }
    .booklist{
        width: 60px;
        height: 36px;
        display: flex;
        align-items: center;
        .imgs{
            width: 20px;
            height: 20px;
            img{
                width: 100%;
            }
        }
        .wenzi{
            width: 30px;
            height: 36px;
            text-align: center;
            line-height: 36px;
            font-size: 12px;
        }
    }
}
.world .tabs{
    width: 50%;
    margin: 0 auto 20px;
    height: 40px;
    line-height: 40px;
    display: flex;
    
    .faxian{
        margin: 0 15px;
        
    }
    .tuijian{
        margin: 0 15px;
    }
    .shijie{
        margin: 0 15px;
        border-bottom: yellow solid 4px;
    }
}

</style>